#ifndef __NM_EXCEPTION_H__
#define __NM_EXCEPTION_H__

#define NONAME_LIB_USE

#include <ntifs.h>
#include "nm_mem.h"

class KException
{
public:

	static void Install();
	NTSTATUS Status() const;
	PVOID const At() const;

protected:
	KException(EXCEPTION_POINTERS const &info);

	static void __cdecl Translator(ULONG Code, EXCEPTION_POINTERS *info);

	PVOID m_IP;
	NTSTATUS m_Status;

};


class KExceptionAccessViolation : public KException
{
public:
	PVOID const Address() const;
	bool IsWrite() const;

	

protected:
	friend KException;

	KExceptionAccessViolation(EXCEPTION_POINTERS const &info);

	PVOID m_Addr;
	bool  m_IsWrite;
};



inline
NTSTATUS KException::Status() const
{
	return m_Status;
}
inline
PVOID const KException::At() const
{
	return m_IP;
}

inline
PVOID const KExceptionAccessViolation::Address() const
{
	return m_Addr;
}
inline
bool KExceptionAccessViolation::IsWrite() const
{
	return m_IsWrite;
}

#endif